cmake_minimum_required(VERSION 3.5.0)
project(quadrotor_common)

if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
# find_package(builtin_interfaces REQUIRED)
find_package(rotor_swarm_msgs REQUIRED)
find_package(Eigen3 REQUIRED)

include_directories(${EIGEN3_INCLUDE_DIRS})
include_directories("/usr/include/eigen3")
include_directories(
  # "include/quadrotor_common"
  include
  ${rotor_swarm_msgs_INCLUDE_DIRS}
  )

add_library(quadrotor_common SHARED 
        src/trajectory_point.cpp
        src/trajectory.cpp
        src/math_common.cpp
        # include/quadrotor_common/trajectory.h
        # include/quadrotor_common/trajectory_point.h
        # include/quadrotor_common/math_common.h
        include/trajectory.h
        include/trajectory_point.h
        include/math_common.h
)

ament_target_dependencies(
        quadrotor_common
        "rclcpp"
        "nav_msgs"
        "rotor_swarm_msgs"
        "geometry_msgs"
        "Eigen3"
)

ament_export_targets(quadrotor_common HAS_LIBRARY_TARGET)
ament_export_dependencies(
        rclcpp
)

install(
  TARGETS quadrotor_common
  EXPORT quadrotor_common
  ARCHIVE DESTINATION lib
  LIBRARY DESTINATION lib
  RUNTIME DESTINATION bin
  INCLUDES DESTINSTION include
)

install(
  DIRECTORY include/
  DESTINATION include/${PROJECT_NAME}
  # DESTINATION include
)

ament_package() 